import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/emergency_accident_report_entity.dart';

EmergencyAccidentReportEntity $EmergencyAccidentReportEntityFromJson(Map<String, dynamic> json) {
  final EmergencyAccidentReportEntity emergencyAccidentReportEntity = EmergencyAccidentReportEntity();
  final String? accidentNameId = jsonConvert.convert<String>(json['accidentNameId']);
  if (accidentNameId != null) {
    emergencyAccidentReportEntity.accidentNameId = accidentNameId;
  }
  final List<String>? accidentScenePhotos = (json['accidentScenePhotos'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (accidentScenePhotos != null) {
    emergencyAccidentReportEntity.accidentScenePhotos = accidentScenePhotos;
  }
  final String? accidentUpdate = jsonConvert.convert<String>(json['accidentUpdate']);
  if (accidentUpdate != null) {
    emergencyAccidentReportEntity.accidentUpdate = accidentUpdate;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    emergencyAccidentReportEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    emergencyAccidentReportEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    emergencyAccidentReportEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    emergencyAccidentReportEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    emergencyAccidentReportEntity.deleted = deleted;
  }
  final String? handleState = jsonConvert.convert<String>(json['handleState']);
  if (handleState != null) {
    emergencyAccidentReportEntity.handleState = handleState;
  }
  final String? handleStateLabel = jsonConvert.convert<String>(json['handleStateLabel']);
  if (handleStateLabel != null) {
    emergencyAccidentReportEntity.handleStateLabel = handleStateLabel;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    emergencyAccidentReportEntity.id = id;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    emergencyAccidentReportEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    emergencyAccidentReportEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    emergencyAccidentReportEntity.updateDate = updateDate;
  }
  return emergencyAccidentReportEntity;
}

Map<String, dynamic> $EmergencyAccidentReportEntityToJson(EmergencyAccidentReportEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['accidentNameId'] = entity.accidentNameId;
  data['accidentScenePhotos'] = entity.accidentScenePhotos;
  data['accidentUpdate'] = entity.accidentUpdate;
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['handleState'] = entity.handleState;
  data['handleStateLabel'] = entity.handleStateLabel;
  data['id'] = entity.id;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension EmergencyAccidentReportEntityExtension on EmergencyAccidentReportEntity {
  EmergencyAccidentReportEntity copyWith({
    String? accidentNameId,
    List<String>? accidentScenePhotos,
    String? accidentUpdate,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? handleState,
    String? handleStateLabel,
    String? id,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return EmergencyAccidentReportEntity()
      ..accidentNameId = accidentNameId ?? this.accidentNameId
      ..accidentScenePhotos = accidentScenePhotos ?? this.accidentScenePhotos
      ..accidentUpdate = accidentUpdate ?? this.accidentUpdate
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..handleState = handleState ?? this.handleState
      ..handleStateLabel = handleStateLabel ?? this.handleStateLabel
      ..id = id ?? this.id
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
